home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11988 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.3 KB

  1. Path: news.iadfw.net!usenet
  2. From: Mark Nelson <markn@airmail.net>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: RS232 & Strings
  5. Date: Wed, 27 Mar 1996 22:54:03 -0600
  6. Organization: customer of Internet America
  7. Message-ID: <315A1B6B.2808@airmail.net>
  8. References: <Pine.SUN.3.91.960326144705.10920A-100000@Ra.MsState.Edu> <315953AB.47C1@airmail.net> <4jc8okINNahh@mayne.ugrad.cs.ubc.ca>
  9. NNTP-Posting-Host: dal07-16.ppp.iadfw.net
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0GoldB2 (Win95; I)
  14.  
  15. Kazimir Kylheku wrote:
  16. > In article <315953AB.47C1@airmail.net>, Mark Nelson  <markn@airmail.net> wrote:
  17. > >> I need to be able to receive a string that is ten
  18. > >
  19. > >You are going to need an interrupt driven routine to receive characters.
  20. > >Trying to read them in using polling is not going to work, because
  21. > >you are inevitably going to miss some characters.
  22. > That is false. Polling is the fastest way to receive characters, at the expense
  23. > of everything. You are less likely to miss characters with _continous_ polling
  24.  
  25. Polling is fine on a machine where you have control over real-time aspects of 
  26. your O/S.  Under Windows or MS-DOS, this is not possible.  You cannot disable 
  27. all other interrupts and expect your machine to work properly.  So while it
  28. would be nice to disable interrupts and poll for input, it simply isn't 
  29. practical.  Under Windows, it becomes close to impossible.
  30.  
  31. > than with interrupts.  The reason modern serial adapters have buffered FIFO
  32. > UARTS is precisely for the reason that interrupt service routines just kick in
  33. > too slowly to keep up with the bps rate! A CPU-wasting polled loop on the same
  34. > hardware could happily ignore the UART, and just pull bytes directly off the
  35. > receive register. I've had one programmer tell me that he transferred a file
  36. > between two 8088 machines at full 115,200 kbps using polled I/O, a feat you
  37. > could not accomplish with an interrupt service routine on the same hardware.
  38.  
  39. Once again, this is great if you are writing your data directly to a memory buffer,
  40. and you aren't worried about messing up the system time, but once you start
  41. writing to disk, all bets are off.
  42.  
  43. For most programmers working on desktop machines, suggesting that they use polling
  44. for their RS-232 applications is *very* bad advice.
  45.  
  46. Mark Nelson
  47. http://web2.airmail.net/markn
  48.